package jp.tuyano.helo.server;

import javax.jdo.PersistenceManager;

import jp.tuyano.core.PMF;
import jp.tuyano.helo.client.DeletePDService;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class DeletePDServiceImpl extends RemoteServiceServlet
        implements DeletePDService {
    
    private static final long serialVersionUID = 1L;

    public String deleteEntity(Long id) {
        PersistenceManager pm = PMF.get().getPersistenceManager();
        PersonalData data = pm.getObjectById(PersonalData.class, id);
        try {
            pm.deletePersistent(data);
        } catch (RuntimeException e) {
            e.printStackTrace();
        } finally {
            pm.close();
        }
        return "OK! delete data!!";
    }

}
